﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;

namespace IDE_week2_Forms_project
{
    public partial class Form1 : Form
    {
        string language;
        

        public Form1()
        {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("pt-BR");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            InitializeComponent();
            language = "pt-BR";
        }

        private void ChangeLanguage(string lang)
        {
            foreach (Control c in this.Controls)
            {
                ComponentResourceManager resources =
                      new ComponentResourceManager(typeof(Form1));
                resources.ApplyResources(c, c.Name, new CultureInfo(lang));
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            Form Form2 = new Form();
            

            Form2.Show();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form1.ActiveForm.Icon = IDE_week2_Forms_project.Properties.Resources.Icon1;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form1.ActiveForm.Icon = default(Icon);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (language == "pt-BR")
            {
                ChangeLanguage("pt-BR");
                language = "en-US";
            }
            else
            {
                ChangeLanguage("en-US");
                    language= "pt-BR";
            }
                
        }

        private void button6_Click(object sender, EventArgs e)
        {
            int[] numbers = new int[10];
            Class1.MakeRandomNumber(numbers);
            label1.Text = numbers[0] + ", " + numbers[1] + ", " + numbers[2];
        }
    }
}
